<%@ page language="java" contentType="text/html; charset=UTF-8"
	pageEncoding="UTF-8"%><%@ include file="pub/top.jsp"%>
<%@ page import="java.util.List,java.util.Map"%>
<%@page import="hyl.core.db.MyDB"%>
<%@page import="com.servlet.My"%>
<!-- 全局变量 函数定义区 -->
<%!%>
<!-- 实例变量 函数定义区 -->
<%
//网页title
String JSPTITLE = "关联用户";
String appid = request.getParameter("app");
String usera = request.getParameter("usera");
%>
<%@ include file="pub/head.jsp"%>
<!-- 样式添加区 -->
<link rel="stylesheet" href="<%=basePath%>DataTables/datatables.min.css">
<!-- 下右内容区 -->
<style>
</style>

<div class="main-content-inner">
	<div class="breadcrumbs ace-save-state" id="breadcrumbs">
		<ul class="breadcrumb">
			<li><i class="ace-icon fa fa-home home-icon"></i>关联用户</li>
			<li class="active"><%=JSPTITLE%></li>
		</ul>
	</div>
	<div class="page-content">
		<!-- page-header{ -->
		<div class="page-header">
			<!-- table header1{ -->
			<div class="row">
				<div class="col-xs-12">
					<div class="clearfix">
						<div class="pull-right tableTools-container"></div>
						<div class="">
							<div class="btn-group" style="margin-top: 5px">
								<a href="#" class="btn-refresh btn  btn-xs "> <i
									class="im-spinner10 fa-spin"></i> 刷新
								</a>
								<!-- <a data-toggle="collapse" href="#demo" class=" btn  btn-xs ">
									<i class="im-spinner10 fa-spin"></i>搜索
								</a> -->
							</div>
						</div>
					</div>
					<div id="demo" class="panel-collapse collapse ">
						<div class="panel-body well">
							<form>
								<div class="col-lg-12 col-sm-12">
									<button type="submit"
										class="btn btn-success btn-sm  pull-right">
										<span class="ace-icon fa fa-search icon-on-right bigger-110"></span>
										查找
									</button>
								</div>
							</form>
						</div>
					</div>
				</div>
			</div>
			<!-- }table -header1  -->
		</div>
		<!-- }page-header  -->

		<!-- table header2{ -->
		<div class="row">
			<div class="col-xs-9 tablehead2L"></div>
			<div class="col-xs-3 tablehead2R"></div>
		</div>
		<!-- }table -header2  -->
		<!--  table { -->
		<div class="row">
			<div class="col-xs-12">
				<form class="form-horizontal" action="" role="form">
					<div class="form-group">
						<label class="col-sm-2 control-label no-padding-right"
							for="form-field-1-1"><i style="color: red">*</i> B系统appid
						</label>
						<div class="col-sm-8">
							<select id="bappid" class="width-80">
								<%
								String sql = "SELECT appid,t0 FROM app";
								MyDB db = My.getDB1();
								List<Object[]> list = db.queryListD(sql, null);
								if (!list.isEmpty()) {
									for (Object[] items : list) {
										String str = String.format("<option value=\"%s\" %s >%s</option>", items[0],
										(items[0].equals(appid) ? "selected readonly" : ""), items[1]);
										out.write(str);
									}
								}
								%>
							</select>
						</div>
						<label class="col-sm-2 "> </label>
					</div>
					<div class="form-group">
						<label class="col-sm-2 control-label no-padding-right"
							for="form-field-1-1"><i style="color: red">*</i>
							单点系统账号或手机号码 </label>
						<div class="col-sm-8">
							<input type="text" id="auser" value="<%=usera%>" class="width-80" />

						</div>
						<label class="col-sm-2 "> </label>
					</div>




					<div class="form-group">
						<label class="col-sm-2 control-label no-padding-right"
							for="form-field-1-1"><i style="color: red">*</i>
							B系统关联用户的手机或账号 </label>
						<div class="col-sm-8">
							<input type="text" id="buser" class="width-60" value="<%=usera%>" />
						</div>
						<label class="col-sm-2 "> </label>
					</div>


					<div class="form-group">
						<label class="col-sm-2 control-label no-padding-right"
							for="form-field-1-1"><i style="color: red">*</i>
							B系统关联用户的密码 </label>
						<div class="col-sm-8">
							<input type="text" id="bpass" class="width-60" />
						</div>
						<label class="col-sm-2 "> </label>
					</div>



					<div class="form-group">
						<input type="button"
							class="btn btn-danger btn-block met1 width-60"
							onclick="Adduser()" value="提交验证">
					</div>

				</form>
			</div>
		</div>
	</div>
</div>

<a href="#" id="btn-scroll-up"
	class="btn-scroll-up btn btn-sm btn-inverse"> <i
	class="ace-icon fa fa-angle-double-up icon-only bigger-110"></i>
</a>

<%@ include file="pub/bottom.jsp"%>
<!-- 引入组件库 -->
<script src="<%=basePath%>DataTables/datatables.min.js"></script>
<script src="<%=basePath%>js/hyl.page.js"></script>
<script src="<%=basePath%>js/md5.js"></script>
<!-- 自定义脚本 加载区 -->
<script>
const JSPTITLE='<%=JSPTITLE%>';
const BASEPATH='<%=basePath%>';
$(document).ready(function(){
	//yhss1();
})

<%-- function yhss1(){
	var roleid = $('#roleid').val();
	$.ajax({
		type : 'get',
		url : '<%=basePath%>admin/Dao/dict_org.jsp',
		data : {"value":roleid},
		success : function(data) {
			var list = JSON.parse(data);
			var html = "";
			for(var i=0;i<list.length;i++){
				html+='<option value="'+list[i].id+'">'+list[i].app+'</option>';
			}
			$('#yhss').html(html);
		}
	});
}
 --%>
var flag=0;
//添加用户
function Adduser(){
	
	if (flag==1) return;
	var auser = $('#auser').val();
	var bappid = $('#bappid').val();
	var buser = $('#buser').val();
	var bpass = hex_md5($('#bpass').val());

	if((auser==null||bappid==""||buser==null||bpass=="")){
		alert("必填信息不能为空");
		return;
	}
	flag=1;
	$.ajax({
		type : 'get',
		url : '<%=basePath%>admin/Dao/appuser_add_dao.jsp',
		data : {"auser":auser,"bappid":bappid,"buser":buser,"bpass":bpass},
		success : function(data) {
			var obj = data;
			console.log(obj)
			alert(obj.MSG);
			flag=0;
			//
			//location= '<%=basePath%>admin/appuser.jsp';
			window.opener.postMessage("ok",'*');
			window.close();
		}
	});
}
</script>
